#pragma once

#include "SkinHeaderCtrl.h"
#include "HorizontalScrollbar.h"
#include "VerticalScrollbar.h"

enum _TAG_CHECK
{
	UNCHECKED = 1,
	CHECKED
};

// CSkinListCtrl

class CSkinListCtrl : public CListCtrl
{
	DECLARE_DYNAMIC(CSkinListCtrl)

public:
	CHorizontalScrollbar	m_HScrollbar;
	CVerticalScrollbar		m_VScrollbar;

private:
	CSkinHeaderCtrl			m_SkinHeaderCtrl;
	
	COLORREF				m_ClrFgHi;
	COLORREF				m_ClrBgHi;
	COLORREF				m_ClrIndicate;

	int m_nIndicate;

public:
	CSkinListCtrl();
	virtual ~CSkinListCtrl();

	void Init(BOOL bCheckBox, int nFontHeight);
	void PositionScrollBars();	

	void EnableHighlighting(HWND hWnd, int row, BOOL bHighlight);
	BOOL IsRowSelected(HWND hWnd, int row);
	BOOL IsRowHighlighted(HWND hWnd, int row);

	void UpdateHScrollPos();
	void SetHeader();
	void SetHeaderCheck(int nCheck);

	void SetItemIndicateColor(COLORREF cIndicate);
	void SetItemIndicate(int nItem);
	int GetItemIndicate();

	void SetItemColor(COLORREF clrHighlightBg, COLORREF clrHighlightFg);

protected:
	afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg void OnCustomDrawList ( NMHDR* pNMHDR, LRESULT* pResult );
	DECLARE_MESSAGE_MAP()

public:
	virtual void PreSubclassWindow();
	afx_msg void OnNMDblclk(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult);
protected:
	virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
};


